package com.sctvcloud.renhe.beans;

import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.ruihang.generalibrary.utils.IDataDate;

import java.io.Serializable;
import java.sql.Date;

/**
 * Created by liuyu on 2017/8/18.
 */

public class NewsDate implements Serializable, IDataDate,Comparable<NewsDate> {
    private static final long serialVersionUID = -6031910488721586941L;
    private String newsDate;
    private String newsListUrl;

    private Date dateTemp;

    private int total;
    private int index = -1;

    public String getNewsDate() {
        return newsDate;
    }

    public void setNewsDate(String newsDate) {
        if (!TextUtils.equals(newsDate, this.newsDate)) {
            dateTemp = null;
        }
        this.newsDate = newsDate;
    }

    public String getNewsListUrl() {
        return newsListUrl;
    }

    public void setNewsListUrl(String newsListUrl) {
        this.newsListUrl = newsListUrl;
    }

    public boolean hasGettedAll() {
        return index >= total - 1;
    }

    @Override
    public Date getDataDate() {
        return dateTemp;
    }

    @Override
    public void setDataDate(Date date) {
        this.dateTemp = date;
    }

    @NonNull
    @Override
    public String getDatePattern() {
        return "yyyy-MM-dd";
    }

    @Override
    public String getDateString() {
        return newsDate;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    @Override
    public int compareTo(@NonNull NewsDate o) {
        return 0;
    }
}
